﻿/***********************************************************
! @File        : mainwindow.h
 *  @Brief       : 插件通信示例
 *  @Details     : 插件通信示例
 *  @Author      : soda
 *  @Date        : 2023-04-28 16:38:37
 *  @Version     : v1.0
 *  @Copyright   : Copyright By soda, All Rights Reserved
 ***********************************************************/
#pragma once
#include <service/event/ctkEventHandler.h>
#include <service/event/ctkEventAdmin.h>
#include <service/event/ctkEventConstants.h>
#include <QQuickView>
#include <FrameLessView.h>
#include "mainmanager.h"

class MainWindow : public QObject, public ctkEventHandler
{
    Q_OBJECT
    Q_INTERFACES(ctkEventHandler)
public:
    explicit MainWindow(ctkPluginContext *context, QObject *parent = nullptr);
    ~MainWindow();

    void quitApp();
    void startAppWithArgs(const QStringList& fileList);
    void TestInterface();
    QQuickView* getQuickView() { return &m_view; };
    void postCtkEvent(const QString event, const QVariant data = QVariant(), const QVariant extentionData = QVariant());

protected:
	ctkEventAdmin* getEventAdmin();
    void handleEvent(const ctkEvent& event);
    void startListening();

public slots:
     void onCtkEvent(const ctkEvent& event);

signals:
     void handleCtkEvent(const ctkEvent& event);

private:
    ctkPluginContext *m_context = nullptr;
    MainManager* m_mainManager = nullptr;
    FrameLessView m_view;

};
